{% extends 'base.html' %}
{% load staticfiles %}
{%block custom_css%}
<style>
    .bta,
    .bta:hover {
        color: #337ab7;
    }
</style>
{%endblock%}

{% block content %}

<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
    <h2>会员搜索</h2>
    <form class="form-horizontal" method="POST" action="/client">
        <div class="form-group">
            <label for="inputEmail3" class="col-sm-2 control-label">姓名</label>
            <div class="col-sm-5">
                <input type="text" class="form-control" name="name" id="inputEmail3">
            </div>
        </div>
        {% csrf_token %}
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-2">
                <button type="submit" class="btn btn-primary">查询</button>
            </div>
        </div>
    </form>
    <h2 class="sub-header">客户信息</h2>
    <div class="table-responsive">
        <table class="table table-striped">
            <thead>
                <tr>
                    <th>#</th>
                    <th>姓名</th>
                    <th>身份证</th>
                    <th>消费总金额</th>
                    <th>手机号</th>
                    <th>性别</th>
                    <th>会员信息</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                {% for client in client_list%}
                <tr>
                    <td>{{forloop.counter}}</td>
                    <td>{{client.name}}</td>
                    <td>{{client.id_card}}</td>
                    <td>{{client.money}}</td>
                    <td>{{client.mobile}}</td>
                    <td>{{client.gender}}</td>
                    {%if client.rant == 1%}
                    <td>钻石会员</td>
                    {%elif client.rant == 2%}
                    <td>白金会员</td>
                    {%elif client.rant == 3%}
                    <td>黄金会员</td>
                    {%else%}
                    <td>普通会员</td>
                    {%endif%}
                    <td>
                        <a type="button" class="btn btn-default bta" href="/client/edit?id={{client.id}}">编辑</a>
                        <a type="button" class="btn btn-default bta" href="/client?id={{client.id}}">删除</a>
                    </td>
                </tr>
                {%endfor %}

            </tbody>
        </table>
        <div class="text-center">
            <a class="btn btn-primary" href="/client?page={{page_pre}}">上一页</a>
            <a class="btn btn-primary" href="/client?page={{page_next}}">下一页</a>
        </div>
    </div>
</div>


{% endblock %}